package cn.iocoder.yudao.module.jikong.dal.mysql.address;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.jikong.dal.dataobject.address.AddressDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.jikong.controller.admin.address.vo.*;

/**
 * 地址管理 Mapper
 *
 * @author admin
 */
@Mapper
public interface AddressMapper extends BaseMapperX<AddressDO> {

    default PageResult<AddressDO> selectPage(AddressPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<AddressDO>()
                .eqIfPresent(AddressDO::getAddress, reqVO.getAddress())
                .likeIfPresent(AddressDO::getContactName, reqVO.getContactName())
                .eqIfPresent(AddressDO::getContactPhone, reqVO.getContactPhone())
                .betweenIfPresent(AddressDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(AddressDO::getId));
    }

}